<?php
require_once 'init.php';
$id            = $_REQUEST['as'];
$obj_page      = new pages();
$result        = $obj_page->get_page_detail($id);

if($result[template_id]!=0){
  $template_id   = $result[template_id];  
  $flag          = template::get_template($template_id);
  $startflag     = trim($flag[template_start_flag]);
  $endflag       = trim($flag[template_end_flag]); 
}
else 
{
$startflag     = $result[page_start_flag];
$endflag       = $result[page_end_flag]; 	

}  

echo $result[page_header];
echo $startflag;
echo $result[page_body];
echo $endflag;
echo $result[page_footer];   

/*
require_once 'init.php';
$id            = $_REQUEST['as'];
$obj_page      = new pages();
$result          = $obj_page->get_page_detail($id);

function set_attrib_path($str)
{
	$path = '../templates/html_contents/56/';
	$arr = array('src="','background="','<param name="movie" value="','type="text/css" href="');
	//echo $str;
	foreach ($arr as $item){		
		$str = str_replace($item,$item.$path,$str);
	}	
	return  $str;
}

echo set_attrib_path(preg_replace('#\<title\>(.+?)\<\/title\>#s', '<title>'.$result[page_url].'</title>', $result[page_header]));
echo $result[page_start_flag];
echo set_attrib_path($result[page_body]);
echo $result[page_end_flag];
echo set_attrib_path($result[page_footer]);   	
*/

	
?>